import { Constructor } from "cc";

/* 获得类名 */
export function nameOfClazz(clz: Constructor<any>): string;
export function nameOfClazz(ins: InstanceType<any>): string;
export function nameOfClazz(arg: any): string {
    if (arg === undefined || arg === null) return typeof arg;
    if (typeof arg === 'function') return arg.name;
    let constructor = !!arg.constructor ? arg.constructor : Object.getPrototypeOf(arg).constructor;
    return constructor.name;
}
